

function BG() {
    
    console.error('BG...');
    
    setTimeout(function(){
        BG();
    }, 5000);
}


/**
 * test
 * **
 */
function test(title){
	/*
	console.log('test: ' + title);
	chrome.notifications.create('notify', request.opt, function(){})
	var config = {};
	config.type = 'basic';
	config.iconUrl = 'images/icon.png';
	config.title = title;
	config.message = '提醒内容';
	config.contextMessage = 'Test';

	chrome.notifications.create('test', config);
	*/
	chrome.notifications.create(null, {
		type: 'basic',
		iconUrl: 'images/icon.png',
		title: '这是标题',
		message: title
	});
}

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    if(request.type === "notify"){
        chrome.notifications.create(null, {
		type: 'basic',
		iconUrl: 'images/icon.png',
		title: request.title || '我是标题',
		message: request.message || '我是内容'
	});
        sendResponse({request:request,sender:sender});
    }
});


